package com.citycloud.ccuap.tc.admin.model;

import com.citycloud.ccuap.commons.sys.entity.SysDeptment;
import com.citycloud.ccuap.commons.sys.entity.SysGroup;
import com.citycloud.ccuap.commons.sys.entity.SysUser;
import lombok.Data;

import java.util.List;

@Data
public class SecUser{
    private SysUser originalUser;
    private String objId;
    private String userId;
    private String allPathName;
    private String dispName;
    private String email;
    private String firstName;
    private String lastName;
    private String tel;
    private String groupId;
    private SysGroup group;
    private String deptId;
    private SysDeptment dept;
    private List<SecRole> roles;
    private Integer postId;
    private List<String> userTypes;
    private String lawEnforcementId;


    public SysUser getOriginalUser() {
        return originalUser;
    }

    public void setOriginalUser(SysUser originalUser) {
        this.originalUser = originalUser;
        this.objId = String.valueOf(originalUser.getUserId());
        this.userId = String.valueOf(originalUser.getUserId());
        this.dispName = String.valueOf(originalUser.getUserName());
        this.email = String.valueOf(originalUser.getEmail());
        this.firstName = null;
        this.lastName = null;
        this.tel = String.valueOf(originalUser.getTelephone());
        this.deptId = String.valueOf(originalUser.getDeptId());
        this.groupId = String.valueOf(originalUser.getGroupId());
    }
    
    public void clearSecUser() {
        this.originalUser.setPassword(null);
        this.originalUser.setDesPassword(null);
        for (SecRole secRole : roles) {
            secRole.clearOriginalRole();
            secRole.setFuncPermissions(null) ;
        }
    }

}
